import axios from "axios";
// request("xxx", "GET", {parmas: {}, headers: {}})
// request("xxx", "POST", {data: {}, headers: {}})
export default function request(
  url: string,
  method: string = "GET",
  options?: any
) {
  return new Promise((resolve, reject) => {
    axios({
      url:
        process.env.NODE_ENV === "development"
          ? url
          : "https://static.xuantong.cn" + url,
      method,
      ...options,
    }).then(({ data }: any) => {
      resolve(data);
    });
  });
}
